From: Florian Müllner Date: Thu, 20 Nov 2025 13:34:21 +0000 (+0100) Subject: swipeTracker: Simplify finding previous point X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~44^2~94 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=8e29babca8adc677;p=gnome-shell.git swipeTracker: Simplify finding previous point We have findLastIndex() nowadays to search an array in reverse direction. Part-of: --- diff --git a/js/ui/swipeTracker.js b/js/ui/swipeTracker.js index 1beecf8b6..30afdef7b 100644 --- a/js/ui/swipeTracker.js +++ b/js/ui/swipeTracker.js @@ -523,8 +523,7 @@ export const SwipeTracker = GObject.registerClass({ } _findPreviousPoint(pos) { - const reversedIndex = this._snapPoints.slice().reverse().findIndex(p => p <= pos); - return this._snapPoints.length - 1 - reversedIndex; + return this._snapPoints.findLastIndex(p => p <= pos); } _findPointForProjection(pos, velocity) {